'use strict';

/* Controllers */
// project edit controller
app.controller('ProjectEditController', [ '$scope', '$http', '$state', 'fileReader',
		function($scope, $http, $state, fileReader) {
			$scope.products = [];
			$scope.newProduct = {};
			
			$scope.teamScale = {};
			$scope.teamScales = [
				{ value: '1', displayValue : '1-10人'},
				{ value: '2', displayValue : '10-50人'},
				{ value: '3', displayValue : '50-100人'},
				{ value: '4', displayValue : '100-500人'},
				{ value: '5', displayValue : '1000人以上'}
			];
			$scope.stage = {};
			$scope.stages = [
				{ value: '1', displayValue : '概念阶段'},
				{ value: '2', displayValue : '产品研发中'},
				{ value: '3', displayValue : '50-100人'},
				{ value: '4', displayValue : '100-500人'},
				{ value: '5', displayValue : '1000人以上'}
				];
			$scope.getFile = function(file) {
				fileReader.readAsDataUrl(file, $scope).then(
						function(result) {
							$scope.imageSrc = result;
						});
			};

			$scope.selectImageFile = function() {
				setTimeout(function() {
					angular.element('#image_file')[0].click();
				}, 0);
			};
			
			$scope.addProduct = function() {
				$scope.products.push($scope.newProduct);
				console.log($scope.products);
				$scope.newProduct = {};
			}
		} ]);
